<?php
  require_once 'DB.php';
  include_once("./libraries/db.inc.php");
  include_once("./libraries/authentication.inc.php");
  include_once("./queries/machine.inc.php");
  include_once("./libraries/util.inc.php");
  include_once("./libraries/displayUtils.inc.php");
  

  session_start();
  sessionAuthenticate("login.php");

  $machineId = $_GET["mid"];  
  
  setUpDisplay("Machine Info");

  $connection=DB::connect($dsn, $options);
  if (DB::isError($connection)) {
    trigger_error($connection->getMessage(), E_USER_ERROR);
  }
  
  $dataIndex="machineById";
  $rs = single_machine_horizontal_query($connection, $dataIndex, $machineId);

  echo "<font size=5><center><b>Machine Info</b></center></font><br />\n";
  echo "<font size=5><center><b>for '{$machineId}'</b></center></font><br />\n";
  printLink("./index.php", "Take me back to the main page!");
  echo "\n";
  if ($_SESSION["administrator"] === true) {
    echo "<br /><p>\n";
    printLink("./adminIndex.php", "Take me back to the Admin screen!");
  }

  echo "<table><tr><td valign=top>\n";
  $rs->printRecordAsVertical(1);
  echo "</td><td valign=top>\n";
  //$dataIndex="machineById2";
  $rs = single_machine_vertical_query($connection, $dataIndex, $machineId);

  $rs->printTable();
  echo "</td></tr></table>\n";

  cdbFinishPage();
  $connection->disconnect();

?>
